package com.own.component.common.aspect;

import com.own.aop.DevelopAop;
import com.own.component.common.em.RequestEnum;
import com.own.component.common.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * DevelopAspect
 *
 * @author chenxueli
 * @date 2020/9/21 11:02
 */
@Slf4j
@Aspect
@Component
public class DevelopAspect {

    @Pointcut("@annotation(com.own.aop.DevelopAop)")
    public void aspect() {
    }

    @Before("aspect() && @annotation(data)")
    public void doBefore(JoinPoint point, DevelopAop data) {
        throw new BusinessException(RequestEnum.API_MAINTENANCE);
    }

}
